//
//  UIViewController+ZYAlertController.m
//  Beautiful
//
//  Created by admin on 2017/5/6.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "UIViewController+ZYAlertController.h"

@implementation UIViewController (ZYAlertController)
#pragma mark -- 封装提示框
- (void)showAlertWithMessage:(NSString *)message WithTitle:(NSString *)title{
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
        
        [alert dismissViewControllerAnimated:YES completion:nil];
        
    }];
    
    [alert addAction:action];
    
    [self presentViewController:alert animated:YES completion:nil];
}
#pragma mark - 显示
-(void)showAlertWithImagepickerWithClickBlock:(void (^)(NSString *))completion
{
    
    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    
    UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"录视频" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        completion(@"3");
    }];
    
    
    
    UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"拍照片" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
      completion(@"1");
    }];
    UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"选照片" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        completion(@"2");
    }];
    [actionSheet addAction:action2];
    [actionSheet addAction:action3];
    [actionSheet addAction:action1];
    
    [self presentViewController:actionSheet animated:YES completion:nil];

}
@end
